PlayCustomAnimation
// FAK - OEI 5/16/05 // Returns TRUE if it found an object to play a custom animation one // oObject is the object to play the animation on // sAnimationName is the name of the gr2 to play // nLooping is 0 for one-off, 1 for loop // fSpeed is the playback speed: 1.0 is default, < 0 is backwards int PlayCustomAnimation( object oObject, string sAnimationName, int nLooping, float fSpeed = 1.0f ); The intent of this function seems to be for use in conversations. If you want to call it from a GUI for an emote nothing will happen. However, there is a simple way to work around this problem. Put it in a wrapper function. For example: void ReallyPlayCustomAnimation(object oObject, string sAnimationName, int nLooping, float fSpeed = 1.0f) { PlayCustomAnimation(oObject, sAnimationName, nLooping, fSpeed); } The wrapper function can even be used to call the game's combat animations, which are not normally available in the toolset. For those it's best to list them as "*nameofanimation" in sAnimationName. The toolset will automatically find the race of the player and the weapon stance for the animation. Thus, instead of using "P_DDF_CBow_1attack01" which would only animate for a female dwarf wielding a bow, we could use "*1attack01" to get the basic weapon use animation of any race and weapon which has a prefix for 1attack01. Using a truly custom combat animation in the same manner is a bit trickier, but not by much. In order to do that you set up the wrapper function as usual and make sure that you have a file copied for each racial skeleton and gender that you plan to use. The abbreviation 'P' indicates that we're using the skeleton for a player character. Those should always be prefixed as: P_DDM for Dwarf Male P_DDF for Dwarf Female P_GGM for Gnome Male P_GGF for Gnome Female P_HHM for Human Male P_HHF for Human Female P_OOM for Half-Orc Male P_OOF for Half-Orc Female Gnomes cover the skeletons for gnomes and human children and the Human skeletons cover everything that isn't a gnome, half-orc, or dwarf. If you don't intend to use an animation for a certain race or gender you can skip making a copy for that type. Next are the abbreviations for stances. For social animations can use UnA, which stands for unarmed. However, there is a catch. If your character equips something the animation will not play. That's because what you have equipped determines your stance. There are two ways to get around this. The long way is to cover all of your bases. You would need to make not only a copy of the animation file for the race and gender, but for each stance. Again, if you don't plan on using the animation while in a particular stance you don't need to make a copy. The stance types are: 1HS – One handed sword 1HSS – One handed sword and shield C2H – Closed 2-Handed Blade O2HT – Open 2 handed thrust (poles, staffs, spears) O2HS – Open 2 handed slash (axes) D2H – Dual 2 Handed CBOW – Cross Bow BOW – Short or Longbow UNA – Unarmed THRN – Sling or Dart A single complete file name for your custom animation should be written as: P_HHM_1hs_myanimation.gr2 The shorter way is for files that have no stance abbreviation, such as P_HHM_meditate.gr2 . For animations like this you simply drop the '*' and enter "meditate" into sAnimationName. The main difference between the two ways depends on how you want your weapon to move. A PC equipped with a rapier, for example, will appear to stick the rapier through their head if you were to call this function using "meditate". By specifying a certain animation for a weapon stance it is possible to avoid awkward impalements. Of course, you could merely execute ActionUnequipItem before this if you aren't in combat. When calling PlayCustomAnimation from within your wrapper function the string sAnimationName should be written as "*myanimation" for any file name that includes a stance and "myanimation" for all others. Both will properly play the animation for any valid copy of the animation file for race, gender, and stance. You cannot truncate the string to "*UnA_myanimation" or even "*HHM_UnA_myanimation" or a similar combination. The good news is that "*myanimation" will play the animation equally as well for an unarmed human male as it will for a half-orc female holding a quarterstaff (assuming that you made copies of all the proper files). PlayCustomAnimation is also preferable sometimes to PlayAnimation because PlayCustomAnimation will not remove currently delayed commands. 'See Also:' PlayCustomAnimation: List of animations }} }}